/* ===========================================
   常量配置文件 - 提取硬编码的常量
   =========================================== */

// API 端点常量
export const API_ENDPOINTS = {
  // 用户相关
  LOGIN: '/login',
  REGISTER: '/users/userAuth/register',
  USER_INFO: '/users',
  UPDATE_PASSWORD: '/users/update/password',
  UPDATE_USER_INFO: '/users/save/userInfo',
  UPDATE_EMAIL_OR_PHONE: '/users/update/EmailOrPhone',
  
  // 好友相关
  FRIENDS_LIST: '/users/get/friendships/3',
  FRIEND_DETAIL: '/users/getFriendById',
  ADD_FRIEND: '/friend/add',
  DELETE_FRIEND: '/users/delete/friend',
  UPDATE_FRIEND_DETAIL: '/users/updateFriendDetail',
  UPDATE_STAR: '/users/updateStar',
  GET_FRIEND_GROUP: '/users/getFriendGroup',
  ADD_FRIEND_GROUP: '/users/addFriendGroup',
  UPDATE_FRIEND_GROUP: '/users/updateFriendGroup',
  MOVE_FRIEND_GROUP: '/users/moveFriendGroup',
  GET_BLACKLIST: '/users/getBlacklistFriend',
  REMOTE_FRIENDSHIPS: '/users/remote/friendships',
  
  // 聊天相关
  SEND_MESSAGE: '/friend_chat/send',
  CHAT_MESSAGE_LIST: '/friend_chat/chatMessageList',
  MARK_MESSAGE_READ: '/friend_chat/markMessageRead',
  CLEAR_CHAT_MESSAGE: '/friend_chat/clearChatMessage',
  SEND_RECOMMEND: '/friend_chat/sendRecommend',
  
  // 群聊相关
  GROUP_CHAT_MESSAGE: '/groups/groupChatMessage',
  GROUP_CHAT_STATUS: '/group_chat/groupChatStatus',
  GROUP_MEMBER: '/group_chat/member',
  PULL_GROUP_CHAT: '/group_chat/pullGroupChat',
  IS_LEADER: '/group_chat/isLeader',
  
  // 文件上传
  UPLOAD_OSS: '/upload/oss',
  UPLOAD_VOICE: '/upload/voice',
  UPLOAD_IMAGE: '/upload/image',
  
  // 动态相关
  DYNAMIC_LISTS: '/users/dynamic/lists',
  OWN_DYNAMICS: '/users/ownDynamics/lists',
  DYNAMIC_DETAIL: '/users/dynamic',
  FRIEND_FEED: '/users/friendFeed',
  FRIEND_FEED_COMMENT: '/users/friendFeed/comment',
  
  // 转账相关
  TRANSFER: '/friend_chat/transfer',
  TRANSFER_MESSAGE: '/users/transfer/message',
  TRANSFER_HISTORY: '/users/transferHistory/byId',
  TRANSFER_FACE_CHECK: '/users/transfer/faceCheck',
  
  // 其他功能
  SEARCH_USER: '/users/search/user',
  USER_ONLINE_STATUS: '/users/userInfo/userOnlineStatus',
  GET_USER_LABEL_LIST: '/users/getUserLabelList',
  COMPLAINTS_CAUSE: '/users/complaintsCause',
  USER_COMPLAINTS: '/users/userComplaints',
  FEEDBACK: '/users/feedback',
  NOTIFY: '/users/notify',
  GET_MESSAGE: '/users/getMessage',
  ANNOUNCEMENT: '/users/announcement',
  
  // 验证相关
  SLIDER_LOCATION: '/sliderlocation',
  VERIFY_SLIDER_LOCATION: '/users/verifysliderlocation',
  SEND_CODE_PHONE: '/users/userAuth/sendCode/phoneRSC',
  SEND_CODE_EMAIL: '/users/userAuth/sendCode/emailRSC',
  PHONE_REGISTER: '/users/userAuth/register/phoneRegister',
  EMAIL_REGISTER: '/users/userAuth/register/emailRegister',
  PHONE_LOGIN: '/users/userAuth/verificationLogin/phone',
  FORGOT_PASSWORD: '/users/forgot/updatePassword',
  GET_LOGIN_ACCOUNT: '/users/getLoginAccount',
  
  // OAuth 登录
  QQ_ACCESS_TOKEN: '/users/QQAccessToken/getAccessToken',
  GITHUB_ACCESS_TOKEN: '/users/gitHubAccessToken/getAccessToken',
  GITEE_ACCESS_TOKEN: '/users/giteeAccessToken/getAccessToken',
  
  // 人脸识别
  FACE_ENTRY: '/users/face/entry',
  ALLOW_FACES: '/users/allow/faces',
  CREATE_RECHARGE_NUMBER: '/users/create/rechargenumber'
};

// 请求配置常量
export const REQUEST_CONFIG = {
  TIMEOUT: 5000,
  CACHE_TIME: 5 * 60 * 1000, // 5分钟缓存
  RETRY_COUNT: 3,
  RETRY_DELAY: 1000
};

// 消息类型常量
export const MESSAGE_TYPES = {
  TEXT: 0,
  IMAGE: 1,
  FILE: 2,
  POSTCARD: 3,
  VOICE_CALL: 4,
  VIDEO_CALL: 5,
  VOICE_MSG: 6,
  TRANSFER: 7,
  APP_LINK: 10,
  QUOTE: 11
};

// 消息类型名称映射
export const MESSAGE_TYPE_NAMES = {
  0: '文本消息',
  1: '图片消息',
  2: '文件消息',
  3: '名片消息',
  4: '语音通话记录',
  5: '视频通话记录',
  6: '语音消息',
  7: '转账消息',
  10: 'APP链接分享',
  11: '引用消息'
};

// 聊天类型常量
export const CHAT_TYPES = {
  SINGLE: 1,    // 单聊
  GROUP: 0      // 群聊
};

// WebSocket 配置
export const WEBSOCKET_CONFIG = {
  WS_URL: 'ws://127.0.0.1:8089/ws',
  RECONNECT_INTERVAL: 5000,
  MAX_RECONNECT_ATTEMPTS: 5
};

// 分页配置
export const PAGINATION_CONFIG = {
  DEFAULT_PAGE: 1,
  DEFAULT_SIZE: 50,
  MAX_SIZE: 100
};

// 缓存键名
export const CACHE_KEYS = {
  CONTACT_LIST: 'contactList_cache',
  USER_INFO: 'userInfo_cache',
  CHAT_MESSAGES: 'chatMessages_cache',
  FRIEND_LIST: 'friendList_cache',
  GROUP_LIST: 'groupList_cache'
};

// 状态码常量
export const STATUS_CODES = {
  SUCCESS: 200,
  UNAUTHORIZED: 401,
  FORBIDDEN: 403,
  NOT_FOUND: 404,
  SERVER_ERROR: 500,
  TOKEN_EXPIRED: 10012,
  ILLEGAL_TOKEN: 10008
};

// 文件类型常量
export const FILE_TYPES = {
  IMAGE: ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp'],
  AUDIO: ['mp3', 'wav', 'ogg', 'aac', 'm4a'],
  VIDEO: ['mp4', 'avi', 'mov', 'wmv', 'flv'],
  DOCUMENT: ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt']
};

// 文件大小限制 (字节)
export const FILE_SIZE_LIMITS = {
  IMAGE: 10 * 1024 * 1024,    // 10MB
  AUDIO: 50 * 1024 * 1024,    // 50MB
  VIDEO: 100 * 1024 * 1024,    // 100MB
  DOCUMENT: 20 * 1024 * 1024   // 20MB
};

// 时间格式常量
export const TIME_FORMATS = {
  DATE: 'YYYY-MM-DD',
  TIME: 'HH:mm:ss',
  DATETIME: 'YYYY-MM-DD HH:mm:ss',
  CHAT_TIME: 'MM-DD HH:mm',
  FULL_TIME: 'YYYY-MM-DD HH:mm:ss'
};

// 颜色常量
export const COLORS = {
  PRIMARY: '#409eff',
  SUCCESS: '#67c23a',
  WARNING: '#e6a23c',
  DANGER: '#f56c6c',
  INFO: '#909399',
  TEXT_PRIMARY: '#303133',
  TEXT_REGULAR: '#606266',
  TEXT_SECONDARY: '#909399',
  TEXT_PLACEHOLDER: '#c0c4cc',
  BORDER_BASE: '#dcdfe6',
  BORDER_LIGHT: '#e4e7ed',
  BORDER_LIGHTER: '#ebeef5',
  BORDER_EXTRA_LIGHT: '#f2f6fc',
  BACKGROUND: '#f5f7fa'
};

// 性别常量
export const GENDER = {
  MALE: 1,
  FEMALE: 2,
  UNKNOWN: 0
};

// 在线状态常量
export const ONLINE_STATUS = {
  ONLINE: 1,
  OFFLINE: 0,
  AWAY: 2,
  BUSY: 3
};

// 消息状态常量
export const MESSAGE_STATUS = {
  SENDING: 'sending',
  SENT: 'sent',
  DELIVERED: 'delivered',
  READ: 'read',
  FAILED: 'failed'
};

// 操作类型常量
export const ACTION_TYPES = {
  SEND_MESSAGE: 10004,
  RESEND_MESSAGE: 10003,
  GROUP_MESSAGE: 10006
};

// 错误消息常量
export const ERROR_MESSAGES = {
  NETWORK_ERROR: '网络连接失败，请检查网络设置',
  TIMEOUT_ERROR: '请求超时，请稍后重试',
  SERVER_ERROR: '服务器错误，请稍后重试',
  UNAUTHORIZED: '登录状态异常，请重新登录',
  FORBIDDEN: '没有权限执行此操作',
  NOT_FOUND: '请求的资源不存在',
  VALIDATION_ERROR: '输入信息有误，请检查后重试'
};

// 成功消息常量
export const SUCCESS_MESSAGES = {
  SAVE_SUCCESS: '保存成功',
  DELETE_SUCCESS: '删除成功',
  SEND_SUCCESS: '发送成功',
  UPDATE_SUCCESS: '更新成功',
  LOGIN_SUCCESS: '登录成功',
  LOGOUT_SUCCESS: '退出成功'
};
